package com.accenture.portal.dao.impl;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.accenture.portal.dao.ArticleMapper;
import com.accenture.portal.model.Article;
import com.accenture.portal.service.impl.ArticleServiceImpl;

@Repository
public class ArticleMapperImpl implements ArticleMapper {
	
	protected static final Logger LOG = Logger.getLogger(ArticleMapperImpl.class);
	
	@Autowired
	ArticleMapper articleMapper;
	
	@Override
	public List<Article> getUnreadArticle(Integer user_id,int zer, int j){
		
		return articleMapper.getUnreadArticle(user_id, zer, j);
	}
	
	@Override
	public List<Article> getUnreadList(Integer user_id,Integer start,Integer end){
		return articleMapper.getUnreadList(user_id,start,end);
	}
	
	@Override
	public int getUnreadCount(int user_id){
		return articleMapper.getUnreadCount(user_id);
	}
	
	@Override
	public List<Article> getAllArticle(){
		return articleMapper.getAllArticle();
	}
	
	@Override
	public Article getContent(Integer article_id){
		return articleMapper.getContent(article_id);
	}
	
	/*@Override
	public void markAsRead(Integer user_id,Integer article_id){
		articleMapper.markAsRead(user_id,article_id);
	}*/
	
	@Override
	public void addArticle(Article article){
		LOG.info("~~~~~~~~@@@DAO~~~~~~~!!!" + article.getContent() + "              " + article.getSubject());
		articleMapper.addArticle(article);	
		
	}
	
	@Override
	public void deleteArticle(Integer article_id){
		articleMapper.deleteArticle(article_id);
	}

	/*@Override
	public void preeditArticle(Article article){
		articleMapper.preeditArticle(article);
	}*/
	
	@Override
	public void editArticle(Article article) {
		articleMapper.editArticle(article);
	}
	
	@Override
	public int getTotalCount(){
		return articleMapper.getTotalCount();
	}
	
	@Override
	public List<Article> getAllByPage(int start,int end){
		return articleMapper.getAllByPage(start, end);
	}
	
	@Override
	public Article getArticleById(Integer article_id){
		return articleMapper.getArticleById(article_id);
	}
	
}
